<?php
	//include("DBParam.php");

	class DBMysql{
		protected $param;

		function __construct($param){
			if( !$param ) throw new Exception("Parâmetros inválidos");
			$this->param = $param;
		}
		
		function _connect(){
			if($this->param->getPort()){
				$this->param->conn = mysql_connect( $this->param->getHost(), $this->param->getUser(), $this->param->getPass() );
			}else{
				$this->param->conn = mysql_connect( $this->param->getHost().":".$this->param->getPort(), $this->param->getUser(), $this->param->getPass() );
			}

			if(!$this->param->conn){
				$this->param->erro = mysql_error($this->param->conn);
				return false;
			}
			
			$this->param->erro = "";
			return true;
		}

		function _disconnect(){
			mysql_close($this->param->conn);
		}
	}
?>
